﻿<Window x:Class="MyProject.Views.UserDialog.UserDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MyProject.Views.UserDialog"
        mc:Ignorable="d"
        Height="450" Width="800">
    
    <Window.Resources>
        <Style TargetType="GroupBox">
            <Setter Property="Border.CornerRadius" Value="4" />
            <Setter Property="Padding" Value="0,10,0,0" />
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Height" Value="24"></Setter>
            <Setter Property="Padding" Value="5,3,0,0"></Setter>
            <Setter Property="TextWrapping" Value="NoWrap"></Setter>
            <Setter Property="Grid.Row" Value="1"></Setter>
        </Style>
        <Style x:Key="FormLabel" TargetType="Label">
            <Setter Property="Padding" Value="5,0,0,0"></Setter>
            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            <Setter Property="VerticalAlignment" Value="Top"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="FormLabelError" TargetType="Label">
            <Setter Property="Height" Value="25"></Setter>
            <Setter Property="Foreground" Value="#FFF50000"></Setter>
            <Setter Property="FontSize" Value="12"></Setter>
            <Setter Property="Grid.Row" Value="2"></Setter>
            <Setter Property="Visibility" Value="Collapsed"></Setter>
        </Style>
        <Style x:Key="GridControl-1" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="0"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="GridControl-2" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="1"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="GridControl-3" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="2"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="GridControl-4" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="3"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="GridControl-6" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="5"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="GridControl-7" TargetType="Grid">
            <Setter Property="Margin" Value="5,0,5,0"></Setter>
            <Setter Property="Grid.ColumnSpan" Value="1"></Setter>
            <Setter Property="Grid.Column" Value="6"></Setter>
            <Setter Property="Grid.Row" Value="0"></Setter>
        </Style>
        <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
            <Setter Property="VerticalAlignment" Value="Top"></Setter>
            <Setter Property="Width" Value="85"></Setter>
            <Setter Property="Height" Value="25"></Setter>
        </Style>
        <Style x:Key="CalendarStyle" TargetType="CalendarButton">
            <Setter Property="Width" Value="85"></Setter>
            <Setter Property="Height" Value="25"></Setter>
        </Style> 
        <Style x:Key="ValidBorder" TargetType="Border">
            <Setter Property="CornerRadius" Value="4"></Setter>
            <Setter Property="Height" Value="24"></Setter>
            <Setter Property="Grid.Row" Value="1"></Setter>
            <Setter Property="BorderBrush" Value="#FFACACAC"></Setter>
            <Setter Property="BorderThickness" Value="1.4"></Setter>
        </Style>
    </Window.Resources>

    <Grid HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="45"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <ScrollViewer Grid.Row="0" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition MinHeight="90"></RowDefinition>
                    <RowDefinition MinHeight="90"></RowDefinition>
                    <RowDefinition MinHeight="90"></RowDefinition>
                    <RowDefinition MinHeight="90"></RowDefinition>
                    <RowDefinition MinHeight="90"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <GroupBox
                    Margin="10,10,10,0"
                    Grid.Row="0"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                    <GroupBox.Header>
                        <TextBlock Text="Сотрудник" Padding="6,0,0,0"></TextBlock>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Style="{StaticResource GridControl-1}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Имя*" Style="{StaticResource FormLabel}"/>
                            <TextBox 
                                x:Name="User_name"
                                Text="{Binding UserData.name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="User_name_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-2}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Фамилия*" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                x:Name="User_surname"
                                Text="{Binding UserData.surname, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="User_surname_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-3}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Отчество" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                x:Name="User_patronymic"
                                Text="{Binding UserData.patronymic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="User_patronymic_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                    </Grid>
                </GroupBox>
                <GroupBox
                    Margin="10,0,10,10"
                    Grid.Row="1"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                    <GroupBox.Header>
                        <TextBlock Text="Паспортные данные сотрдуника*" Padding="6,0,0,0"></TextBlock>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid 
                            Style="{StaticResource GridControl-1}"
                            Margin="0"
                            Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid Style="{StaticResource GridControl-1}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20"></RowDefinition>
                                    <RowDefinition Height="24"></RowDefinition>
                                    <RowDefinition Height="25"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Label Content="Серия" Style="{StaticResource FormLabel}"/>
                                <TextBox
                                    MaxLength="4"
                                    ToolTip="Серия состоит из 4 цифр"
                                    PreviewTextInput="NumberValidationTextBox"
                                    x:Name="Passport_series"
                                    Text="{Binding Passport.series, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                    <TextBox.Resources>
                                        <Style TargetType="{x:Type Border}">
                                            <Setter Property="CornerRadius" Value="4"/>
                                        </Style>
                                    </TextBox.Resources>
                                </TextBox>
                                <Label x:Name="Passport_series_Error" Style="{StaticResource FormLabelError}"/>
                            </Grid>
                            <Grid Style="{StaticResource GridControl-2}" Grid.ColumnSpan="2">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20"></RowDefinition>
                                    <RowDefinition Height="24"></RowDefinition>
                                    <RowDefinition Height="25"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Label Content="Номер" Style="{StaticResource FormLabel}"/>
                                <TextBox
                                    MaxLength="6"
                                    ToolTip="Номер состоит из 6 цифр"
                                    PreviewTextInput="NumberValidationTextBox"
                                    x:Name="Passport_number"
                                    Text="{Binding Passport.number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                    <TextBox.Resources>
                                        <Style TargetType="{x:Type Border}">
                                            <Setter Property="CornerRadius" Value="4"/>
                                        </Style>
                                    </TextBox.Resources>
                                </TextBox>
                                <Label x:Name="Passport_number_Error" Style="{StaticResource FormLabelError}"/>
                            </Grid>
                        </Grid>

                        <Grid Style="{StaticResource GridControl-3}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Дата выдачи" Style="{StaticResource FormLabel}"/>
                            <Border 
                                CornerRadius="4"
                                Height="25"
                                x:Name="Passport_date_of_issue_border" 
                                Grid.Row="1"
                                BorderBrush="#FFACACAC" 
                                BorderThickness="1.4">
                                <DatePicker
                                    Height="24"
                                    x:Name="Passport_date_of_issue"
                                    PreviewTextInput="DateValidationTextBox"
                                    SelectedDate="{Binding Passport.date_of_issue,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                    InputScope="Date">
                                    <DatePicker.Resources>
                                        <Style TargetType="{x:Type Border}">
                                            <Setter Property="CornerRadius" Value="4"/>
                                        </Style>
                                    </DatePicker.Resources>
                                </DatePicker>
                            </Border>
                            <Label x:Name="Passport_date_of_issue_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-4}" Grid.ColumnSpan="3">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Кем выдан" Style="{StaticResource FormLabel}"/>
                            <Border 
                                CornerRadius="4"
                                Height="24"
                                x:Name="Passport_issued_by_whom_id_border" 
                                Grid.Row="1"
                                BorderBrush="#FFACACAC" 
                                BorderThickness="1.4">
                                <ComboBox
                                    HorizontalAlignment="Stretch"
                                    Style="{StaticResource Combobox_Base}"
                                    x:Name="Passport_issued_by_whom_id"
                                    Height="21.5"
                                    SelectedValuePath="id"
                                    ItemsSource="{Binding Lists.Departments}"
                                    SelectedValue="{Binding Passport.issued_by_whom_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                </ComboBox>
                            </Border>
                            <Label x:Name="Passport_issued_by_whom_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                    </Grid>
                </GroupBox>
                <GroupBox
                    Margin="10,0,10,10"
                    Grid.Row="2"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                    <GroupBox.Header>
                        <TextBlock Text="Адрес регистрации" Padding="6,0,0,0"></TextBlock>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Style="{StaticResource GridControl-1}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Индекс*" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                    MaxLength="8"
                                    ToolTip="Индекс состоит из 8 цифр"
                                    PreviewTextInput="NumberValidationTextBox"
                                    x:Name="Address_index"
                                    Text="{Binding Registration.index, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_index_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-2}" Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Город*" Style="{StaticResource FormLabel}"/>
                            <Border 
                                Style="{StaticResource ValidBorder}"
                                x:Name="Address_city_id_border">
                                <ComboBox
                                        HorizontalAlignment="Stretch"
                                        Style="{StaticResource Combobox_Base}"
                                        x:Name="Address_city_id"
                                        Height="21.5"
                                        SelectedValuePath="id"
                                        ItemsSource="{Binding Lists.Cities}"
                                        SelectedValue="{Binding Registration.city_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                        SelectionChanged="RegistrationCitySelectionChanged">
                                </ComboBox>
                            </Border>
                            <Label x:Name="Address_city_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-4}" Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Улица*" Style="{StaticResource FormLabel}"/>
                            <Border
                                Style="{StaticResource ValidBorder}"
                                x:Name="Address_street_id_border">
                                <ComboBox
                                    ToolTip="Для начала выберите город"
                                    HorizontalAlignment="Stretch"
                                    Style="{StaticResource Combobox_Base}"
                                    x:Name="Address_street_id"
                                    Height="21.5"
                                    SelectedValuePath="id"
                                    SelectedValue="{Binding Registration.street_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                </ComboBox>
                            </Border>
                            <Label x:Name="Address_street_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-6}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Дом*" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                MaxLength="6"
                                x:Name="Address_house"
                                Text="{Binding Registration.house, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_house_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-7}" Grid.ColumnSpan="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Кв" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                MaxLength="3"
                                x:Name="Address_apartment"
                                Text="{Binding Registration.apartment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_apartment_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                    </Grid>
                </GroupBox>
                <GroupBox
                    Margin="10,0,10,10"
                    Grid.Row="3"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                    <GroupBox.Header>
                        <TextBlock Text="Адрес проживания" Padding="6,0,0,0"></TextBlock>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Style="{StaticResource GridControl-1}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Индекс*" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                    MaxLength="8"
                                    ToolTip="Индекс состоит из 8 цифр"
                                    PreviewTextInput="NumberValidationTextBox"
                                    x:Name="Address_1_index"
                                    Text="{Binding Residence.index, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_1_index_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-2}" Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Город*" Style="{StaticResource FormLabel}"/>
                            <Border  
                                Style="{StaticResource ValidBorder}"
                                x:Name="Address_1_city_id_border">
                                <ComboBox
                                        HorizontalAlignment="Stretch"
                                        Style="{StaticResource Combobox_Base}"
                                        x:Name="Address_1_city_id"
                                        Height="21.5"
                                        SelectedValuePath="id"
                                        ItemsSource="{Binding Lists.Cities}"
                                        SelectedValue="{Binding Residence.city_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                        SelectionChanged="ResidenceCitySelectionChanged">
                                </ComboBox>
                            </Border>
                            <Label x:Name="Address_1_city_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-4}" Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Улица*" Style="{StaticResource FormLabel}"/>
                            <Border
                                Style="{StaticResource ValidBorder}"
                                x:Name="Address_1_street_id_border">
                                <ComboBox
                                    IsReadOnly="True"
                                    ToolTip="Для начала выберите город"
                                    HorizontalAlignment="Stretch"
                                    Style="{StaticResource Combobox_Base}"
                                    x:Name="Address_1_street_id"
                                    Height="21.5"
                                    SelectedValuePath="id"
                                    SelectedValue="{Binding Residence.street_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                </ComboBox>
                            </Border>
                            <Label x:Name="Address_1_street_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-6}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Дом*" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                MaxLength="6"
                                x:Name="Address_1_house"
                                Text="{Binding Residence.house, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_1_house_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-7}" Grid.ColumnSpan="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Кв" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                MaxLength="3"
                                x:Name="Address_1_apartment"
                                Text="{Binding Residence.apartment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Address_1_apartment_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                    </Grid>
                </GroupBox>
                <GroupBox
                    Margin="10,0,10,10"
                    Grid.Row="4"
                    Grid.Column="0"
                    Grid.ColumnSpan="3">
                    <GroupBox.Header>
                        <TextBlock Text="Трудовой договор" Padding="6,0,0,0"></TextBlock>
                    </GroupBox.Header>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Style="{StaticResource GridControl-1}" ToolTip="Данное поле будет заполнено автоматически">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Номер договора" Style="{StaticResource FormLabel}"/>
                            <TextBox
                                IsReadOnly="True"
                                x:Name="Contract_id"
                                IsEnabled="False"
                                Text="{Binding Contract.id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                <TextBox.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </TextBox.Resources>
                            </TextBox>
                            <Label x:Name="Contract_id_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-2}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Дата договора*" Style="{StaticResource FormLabel}"/>
                            <DatePicker
                                x:Name="Passport_creation_date"
                                PreviewTextInput="DateValidationTextBox"
                                Grid.Row="1"
                                SelectedDate="{Binding Contract.creation_date,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                                <DatePicker.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </DatePicker.Resources>
                            </DatePicker>
                            <Label x:Name="Contract_creation_date_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                        <Grid Style="{StaticResource GridControl-3}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                                <RowDefinition Height="24"></RowDefinition>
                                <RowDefinition Height="25"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Label Content="Дата приема на работу" Style="{StaticResource FormLabel}"/>
                            <DatePicker
                                x:Name="Passport_employment_date"
                                PreviewTextInput="DateValidationTextBox"
                                Grid.Row="1"
                                SelectedDate="{Binding Contract.employment_date,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                                <DatePicker.Resources>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="CornerRadius" Value="4"/>
                                    </Style>
                                </DatePicker.Resources>
                            </DatePicker>
                            <Label x:Name="Contract_employment_date_Error" Style="{StaticResource FormLabelError}"/>
                        </Grid>
                    </Grid>
                </GroupBox>
            </Grid>
        </ScrollViewer>

        <StackPanel
            Grid.Row="1"
            Grid.Column="0"
            Orientation="Horizontal"
            Margin="10"
            VerticalAlignment="Bottom">
            <Button
                Style="{StaticResource ButtonStyle}"
                Command="{Binding InputCommand}"
                CommandParameter="Save">
                <Button.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius" Value="4"/>
                    </Style>
                </Button.Resources>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="0,1,0,0" ><Run Text="Сохранить"/></TextBlock>
                </StackPanel>
            </Button>
            <Button 
                Style="{StaticResource ButtonStyle}"
                Command="{Binding InputCommand}"
                CommandParameter="Cancel"
                Margin="10,0,0,0">
                <Button.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius" Value="4"/>
                    </Style>
                </Button.Resources>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="0,1,0,0" ><Run Text="Отмена"/></TextBlock>
                </StackPanel>
            </Button>
        </StackPanel>
    </Grid>
</Window>
